package com.company;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        System.out.println("请输入一串字符串以判断其是否可以由其子串重复多次构成");
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        if(repeatedSubstringPattern(s))
        {
            System.out.println("字符串" + s + "可以由其子串重复多次构成");
        }
        else
        {
            System.out.println("字符串" + s + "不可以由其子串重复多次构成");
        }

    }
    public static boolean repeatedSubstringPattern(String s) {
        String str = s + s;
        str = str.substring(1,str.length() - 1);
        if(str.indexOf(s) == -1)
        {
            return false;
        }
        return true;
    }
}

